home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995…tember: Reference Library / Dev.CD Sep 95 RL / Dev.CD Sep 95 RL.toast / mac / Technical Documentation / develop / develop Issue 23 code / Internet Config / IC 1.1 / ICProgKit1.1 / Source / Internet Config Source / ICCAPI.p < prev    next >
Encoding:
Text File  |  1995-04-23  |  6.1 KB  |  169 lines  |  [TEXT/PJMM]

  1. unit ICCAPI;
  2.  
  3. interface
  4.  
  5.     uses
  6. {$ifc undefined THINK_Pascal}
  7.         Types, Files, QuickDraw, AppleTalk, Aliases, 
  8. {$endc}
  9.         Components, ICTypes, ICKeys;
  10.  
  11.     const
  12.         internetConfigurationComponentType = 'PREF';                (* the component type *)
  13.         internetConfigurationComponentSubType = 'ICAp';            (* the component subtype *)
  14.         internetConfigurationComponentInterfaceVersion0 = $00000000;
  15.         internetConfigurationComponentInterfaceVersion1 = $00010000;
  16. (* current version number is version 1 *)
  17.         internetConfigurationComponentInterfaceVersion = internetConfigurationComponentInterfaceVersion1;
  18.  
  19.     function ICCStart (var inst: ComponentInstance; creator: OSType): ICError;
  20.     (* checks for the presence of the Component Manager and the Internet Configuration component *)
  21.     (* returns badComponentInstance if it can't find either*)
  22.     (* inst is either nil or a valid component instance *)
  23.     (* this routine lets you access the component based implementation with only minimal*)
  24.     (* yucky glue *)
  25.     function ICCStop (inst: ComponentInstance): ICError;
  26.     (* shut down the component *)
  27.  
  28.     function ICCFindConfigFile (inst: ComponentInstance; count: integer; folders: ICDirSpecArrayPtr): ICError;
  29.     inline
  30.         $2F3C, $06, $2, $7000, $A82A;
  31.     function ICCFindUserConfigFile (inst: ComponentInstance; where: ICDirSpec): ICError;
  32.     inline
  33.         $2F3C, $04, $E, $7000, $A82A;
  34.     function ICCSpecifyConfigFile (inst: ComponentInstance; config: FSSpec): ICError;
  35.     inline
  36.         $2F3C, $04, $3, $7000, $A82A;
  37.  
  38.     function ICCGetSeed (inst: ComponentInstance; var seed: longint): ICError;
  39.     inline
  40.         $2F3C, $04, $4, $7000, $A82A;
  41.     function ICCGetPerm (inst: ComponentInstance; var perm: ICPerm): ICError;
  42.     inline
  43.         $2F3C, $04, $D, $7000, $A82A;
  44.  
  45.     function ICCBegin (inst: ComponentInstance; perm: ICPerm): ICError;
  46.     inline
  47.         $2F3C, $02, $5, $7000, $A82A;
  48.     function ICCGetPref (inst: ComponentInstance; key: Str255; var attr: ICAttr; buf: Ptr; var size: longint): ICError;
  49.     inline
  50.         $2F3C, $10, $6, $7000, $A82A;
  51.     function ICCSetPref (inst: ComponentInstance; key: Str255; attr: ICAttr; buf: Ptr; size: longint): ICError;
  52.     inline
  53.         $2F3C, $10, $7, $7000, $A82A;
  54.     function ICCGetPrefHandle (inst: ComponentInstance; key: Str255; var attr: ICAttr; var prefh: Handle): ICError;
  55.     inline
  56.         $2F3C, $0C, $1A, $7000, $A82A;
  57.     function ICCSetPrefHandle (inst: ComponentInstance; key: Str255; attr: ICAttr; prefh: Handle): ICError;
  58.     inline
  59.         $2F3C, $0C, $1B, $7000, $A82A;
  60.     function ICCCountPref (inst: ComponentInstance; var count: longint): ICError;
  61.     inline
  62.         $2F3C, $04, $8, $7000, $A82A;
  63.     function ICCGetIndPref (inst: ComponentInstance; n: longint; var key: Str255): ICError;
  64.     inline
  65.         $2F3C, $08, $9, $7000, $A82A;
  66.     function ICCDeletePref (inst: ComponentInstance; key: Str255): ICError;
  67.     inline
  68.         $2F3C, $04, $C, $7000, $A82A;
  69.     function ICCEnd (inst: ComponentInstance): ICError;
  70.     inline
  71.         $2F3C, $00, $A, $7000, $A82A;
  72.  
  73.     function ICCDefaultFileName (inst: ComponentInstance; var name: Str63): ICError;
  74.     inline
  75.         $2F3C, $04, $B, $7000, $A82A;
  76.  
  77.     function ICCEditPreferences (inst: ComponentInstance; key: Str255): ICError;
  78.     inline
  79.         $2F3C, $04, $F, $7000, $A82A;
  80.  
  81.     function ICCParseURL (inst: ComponentInstance; hint: Str255; data: Ptr; len: longint; var selStart, selEnd: longint; url: Handle): ICError;
  82.     inline
  83.         $2F3C, $18, $10, $7000, $A82A;
  84.     function ICCLaunchURL (inst: ComponentInstance; hint: Str255; data: Ptr; len: longint; var selStart, selEnd: longint): ICError;
  85.     inline
  86.         $2F3C, $14, $11, $7000, $A82A;
  87.  
  88.     function ICCMapFilename (inst: ComponentInstance; filename: Str255; var entry: ICMapEntry): ICError;
  89.     inline
  90.         $2F3C, $08, $18, $7000, $A82A;
  91.     function ICCMapTypeCreator (inst: ComponentInstance; fType, fCreator: OSType; filename: Str255; var entry: ICMapEntry): ICError;
  92.     inline
  93.         $2F3C, $10, $19, $7000, $A82A;
  94.  
  95.     function ICCMapEntriesFilename (inst: ComponentInstance; entries: Handle; filename: Str255; var entry: ICMapEntry): ICError;
  96.     inline
  97.         $2F3C, $0C, $1C, $7000, $A82A;
  98.     function ICCMapEntriesTypeCreator (inst: ComponentInstance; entries: Handle; fType, fCreator: OSType; filename: Str255; var entry: ICMapEntry): ICError;
  99.     inline
  100.         $2F3C, $14, $1D, $7000, $A82A;
  101.  
  102.     function ICCCountMapEntries (inst: ComponentInstance; entries: Handle; var count: longint): ICError;
  103.     inline
  104.         $2F3C, $08, $12, $7000, $A82A;
  105.     function ICCGetIndMapEntry (inst: ComponentInstance; entries: Handle; ndx: longint; var pos: longint; var entry: ICMapEntry): ICError;
  106.     inline
  107.         $2F3C, $10, $13, $7000, $A82A;
  108.     function ICCGetMapEntry (inst: ComponentInstance; entries: Handle; pos: longInt; var entry: ICMapEntry): ICError;
  109.     inline
  110.         $2F3C, $0C, $14, $7000, $A82A;
  111.     function ICCSetMapEntry (inst: ComponentInstance; entries: Handle; pos: longInt; var entry: ICMapEntry): ICError;
  112.     inline
  113.         $2F3C, $0C, $15, $7000, $A82A;
  114.     function ICCDeleteMapEntry (inst: ComponentInstance; entries: Handle; pos: longint): ICError;
  115.     inline
  116.         $2F3C, $08, $16, $7000, $A82A;
  117.     function ICCAddMapEntry (inst: ComponentInstance; entries: Handle; var entry: ICMapEntry): ICError;
  118.     inline
  119.         $2F3C, $08, $17, $7000, $A82A;
  120.  
  121. implementation
  122.  
  123. {$ifc undefined THINK_Pascal}
  124.     uses
  125.         GestaltEqu;
  126. {$endc}
  127.  
  128.     function ICCStartComponent (inst: ComponentInstance; creator: OSType): ICError;
  129.     inline
  130.         $2F3C, $04, $0, $7000, $A82A;
  131.     function ICCStopComponent (inst: ComponentInstance): ICError;
  132.     inline
  133.         $2F3C, $00, $1, $7000, $A82A;
  134.  
  135.     function ICCStart (var inst: ComponentInstance; creator: OSType): ICError;
  136.         var
  137.             err, junk: ICError;
  138.             response: longint;
  139.     begin
  140.         inst := nil;
  141.         if Gestalt(gestaltComponentMgr, response) = noErr then begin
  142.             inst := OpenDefaultComponent(internetConfigurationComponentType, internetConfigurationComponentSubType);
  143.         end; (* if *)
  144.         if inst = nil then begin
  145.             err := badComponentInstance;
  146.         end
  147.         else begin
  148.             err := ICCStartComponent(inst, creator);
  149.             if err <> noErr then begin
  150.                 junk := CloseComponent(inst);
  151.                 inst := nil;
  152.             end; (* if *)
  153.         end; (* if *)
  154.         ICCStart := err;
  155.     end; (* ICCStart *)
  156.  
  157.     function ICCStop (inst: ComponentInstance): ICError;
  158.         var
  159.             err, err2: ICError;
  160.     begin
  161.         err := ICCStopComponent(inst);
  162.         err2 := CloseComponent(inst);
  163.         if err = noErr then begin
  164.             err := err2;
  165.         end; (* if *)
  166.         ICCStop := err;
  167.     end; (* ICCStop *)
  168.  
  169. end. (* ICCAPI *)